<if condition="empty($address_list)">
<script type="text/javascript">
	$(document).ready(function(){
		layer.closeAll('page');		
	});
</script>
<else />
<div class="address-list">
<div class="l-a-title"><span>管理收货地址</span></div>
<foreach name="address_list" item="v"  key="k">
	<div class="address-info <if condition="$v['is_default'] eq 1">active</if>" data-id="{$v[address_id]}">
		<input type="radio" name="is_default" value="{$v[is_default]}" style="display:none;" <if condition="$v['is_default'] eq 1">checked</if> />
		<a href="javascript:;" onclick="layerPrompt('{$v[address_id]}')" class="del-address"><i class="fa fa-trash"></i></a>
		<if condition="$v['is_default'] eq 1">
		<span class="default">默认地址</span>
		</if>		
		<p><span>收货人：</span>{$v[consignee]}</p>
		<p><span>联系电话：</span>{$v[mobile]}</p>
		<p><span>收货地址：</span>{$regionList[$v[province]]}{$regionList[$v[city]]}{$regionList[$v[district]]}{$regionList[$v[twon]]}{$v[address]}</p>
	</div>	               
</foreach>
<div class="bt-btn">
	<button class="btn btn-on" onclick="ajaxDefaultAddress()">确定</button>
	<button class="btn btn-off" onclick="layer.closeAll('page')">取消</button>
</div>
</div>
<script type="text/javascript">
	function layerPrompt(id){		
		layer.confirm('确定要删除吗？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			del_address(id);
			layer.closeAll('page');
			layer.msg(null);
		}, function(){
		  
		});
	}
</script>
<script type="text/javascript">
	 $(".address-list").on("click", ".address-info", function () {
                var input = $(this).find("input");
                
                    $(".address-info").find("input").each(function () {
                        $(this).removeAttr("checked");
                    });
                    $(input).attr("checked", true);
					
                
				var _check = $('input:radio[name="is_default"]:checked').val();
				if(_check){
					$(input).parent().addClass('active');
					$(input).parent().siblings().removeClass('active');
				}
            });
</script>
</if>